package com.snpic.appaw.module.insure.dal.mysql.cxProvince;

import com.snpic.appaw.framework.common.pojo.PageResult;
import com.snpic.appaw.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.snpic.appaw.framework.mybatis.core.mapper.BaseMapperX;
import com.snpic.appaw.module.insure.controller.app.cxProvince.vo.AppCxProvincePageReqVO;
import com.snpic.appaw.module.insure.dal.dataobject.cxProvince.CxProvinceDO;
import org.apache.ibatis.annotations.Mapper;

import static com.snpic.appaw.framework.common.pojo.PageParam.PAGE_SIZE_NONE;

/**
 * 车险出单配置-市与车险省市映射 Mapper
 * @author jijun
 */
@Mapper
public interface CxProvinceMapper extends BaseMapperX<CxProvinceDO> {
    //不分页!!
    default PageResult<CxProvinceDO> selectPage(AppCxProvincePageReqVO reqVO) {
        return selectPage(reqVO.setPageSize(PAGE_SIZE_NONE), new LambdaQueryWrapperX<CxProvinceDO>()
                .eqIfPresent(CxProvinceDO::getTdProvinceId, reqVO.getTdProvinceId())
                .likeIfPresent(CxProvinceDO::getTdProvinceName, reqVO.getTdProvinceName())
                .eqIfPresent(CxProvinceDO::getTdCityId, reqVO.getTdCityId())
                .likeIfPresent(CxProvinceDO::getTdCityName, reqVO.getTdCityName())
                .eqIfPresent(CxProvinceDO::getCxProvinceId, reqVO.getCxProvinceId())
                .likeIfPresent(CxProvinceDO::getCxProvinceName, reqVO.getCxProvinceName())
                .eqIfPresent(CxProvinceDO::getCxCityCode, reqVO.getCxCityCode())
                .likeIfPresent(CxProvinceDO::getCxCityName, reqVO.getCxCityName())
                .eqIfPresent(CxProvinceDO::getCarPlate, reqVO.getCarPlate())
                .eqIfPresent(CxProvinceDO::getIsUse, reqVO.getIsUse())
                .eqIfPresent(CxProvinceDO::getCarNote, reqVO.getCarNote())
                .eqIfPresent(CxProvinceDO::getFlag, reqVO.getFlag())
                .eqIfPresent(CxProvinceDO::getIssueChannel, reqVO.getIssueChannel())
                .eqIfPresent(CxProvinceDO::getSolutionCode, reqVO.getSolutionCode())
                .eqIfPresent(CxProvinceDO::getCompanyCode, reqVO.getCompanyCode())
                .eqIfPresent(CxProvinceDO::getIssueCompany, reqVO.getIssueCompany())
                .likeIfPresent(CxProvinceDO::getSalesmanName, reqVO.getSalesmanName())
                .eqIfPresent(CxProvinceDO::getSalesmanCode, reqVO.getSalesmanCode())
                .betweenIfPresent(CxProvinceDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CxProvinceDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CxProvinceDO::getOldId, reqVO.getOldId())
                .orderByDesc(CxProvinceDO::getId));
    }

}